﻿using System;
using System.Collections.Generic;
using System.Text;

namespace System.Data
{
    /// <summary>
    /// 最大长度
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class MaxAttribute : Attribute
    {
        public MaxAttribute()
        {

        }
    }
    /// <summary>
    /// DbParameter 配置特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public sealed class DbParameterAttribute:Attribute {
        /// <summary>
        /// 构造函数
        /// </summary>
        public DbParameterAttribute() {
            Direction = ParameterDirection.Input;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="direction">参数方向</param>
        public DbParameterAttribute(ParameterDirection direction) {
            Direction = direction;
        }

        /// <summary>
        /// 参数输出方向
        /// </summary>
        public ParameterDirection Direction { get; set; }

        /// <summary>
        /// 数据库对应类型
        /// </summary>
        public object DbType { get; set; }

        /// <summary>
        /// 大小
        /// </summary>
        /// <remarks>Nvarchar/varchar类型需指定</remarks>
        public int Size { get; set; }
    }
    /// <summary>
    /// 配置表名称前缀
    /// </summary>
    [AttributeUsage(AttributeTargets.Class,AllowMultiple = false)]
    public class TablePrefixAttribute:Attribute {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="prefix"></param>
        public TablePrefixAttribute(string prefix) {
            Prefix = prefix;
        }
        /// <summary>
        /// 前缀
        /// </summary>
        public string Prefix { get; set; }
    }
}
